const path = require("path");

console.log(__dirname + "/index.html"); // E:\font-code\08.Node\sgg\04_path/index.html

// resolve 解决
console.log(path.resolve(__dirname, "./index.html")); // E:\font-code\08.Node\sgg\04_path\index.html
console.log(path.resolve(__dirname, "/index.html")); // E:\index.html
console.log(path.resolve(__dirname, "./index.html", "./test")); // E:\font-code\08.Node\sgg\04_path\index.html\test

// sep 分隔符 window: \ linux /
console.log(path.sep);

// parse
// E:\font-code\08.Node\sgg\04_path\01_初始path.js
let str = "E:\\font-code\\08.Nodesgg\\04_path\\01_初始path.js";
// console.log(path.parse(str));

console.log(path.basename(str));
console.log(path.dirname(str));
console.log(path.extname(str));
